package com.test.first;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class Main3Activity extends AppCompatActivity {

    TextView scoreA, scoreB;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);

        scoreA = (TextView) findViewById(R.id.scoreA);
        scoreB = (TextView) findViewById(R.id.scoreB);
    }

    public void btnAdd1(View btn) {
        showScoreA(1);

    }

    public void btnAdd2(View btn) {
        showScoreA(2);

    }

    public void btnAdd3(View btn) {
        showScoreA(3);

    }

    public void btnAdd4(View btn) {
        showScoreB(1);

    }

    public void btnAdd5(View btn) {
        showScoreB(2);

    }

    public void btnAdd6(View btn) {
        showScoreB(3);

    }

    public void btnReset(View btn) {
        scoreA.setText("0");
        scoreB.setText("0");

    }

    private void showScoreA(int inc) {

        String oldScoreA = (String) scoreA.getText();
        int newScoreA = Integer.parseInt(oldScoreA) + inc;
        scoreA.setText("" + newScoreA);

    }

    private void showScoreB(int inc) {

        String oldScoreB = (String) scoreB.getText();
        int newScoreB = Integer.parseInt(oldScoreB) + inc;
        scoreB.setText("" + newScoreB);


    }
}